# Maintainer: Massimiliano Torromeo <massimiliano.torromeo@gmail.com>
# Contributor: Daniele Paolella <dp@mcrservice.it>

pkgname=supervisor
pkgver=4.2.5
pkgrel=2
pkgdesc="A system for controlling process state under UNIX"
arch=('any')
url="http://supervisord.org"
license=('custom')
depends=('python-setuptools')
backup=('etc/supervisord.conf')
source=("https://files.pythonhosted.org/packages/source/s/$pkgname/$pkgname-$pkgver.tar.gz"
        'supervisord.service'
        'supervisor.logrotate'
        'supervisord.conf')
sha256sums=('34761bae1a23c58192281a5115fb07fbf22c9b0133c08166beffc70fed3ebc12'
            '111f632081633dafae18ff069001e9ea78e9a24669ed75efc196f8d83d92f993'
            '7347d79c8b7f5cc59d5ffa31e4df64f92e89dee0dc84bdb3bdfcba212de93f4b'
            '438cd77598b8c7fca12488869f836f5ebba41b23591c26ea1a4a5cea50041986')

build() {
	cd "$srcdir/$pkgname-$pkgver"
	python setup.py build
}

package() {
	cd "$srcdir/$pkgname-$pkgver"
	python setup.py install -O1 --skip-build --prefix=/usr --root="$pkgdir"
	install -Dm600 "$srcdir/supervisord.conf" "$pkgdir/etc/supervisord.conf"
	install -Dm644 "$srcdir/supervisor.logrotate" "$pkgdir/etc/logrotate.d/supervisor"
	install -Dm644 "$srcdir/supervisord.service" "$pkgdir/usr/lib/systemd/system/supervisord.service"
	install -d "$pkgdir/usr/share/licenses/$pkgname"
	install -d "$pkgdir/var/log/$pkgname"
	install -d "$pkgdir/etc/supervisor.d"
	mv LICENSES.txt COPYRIGHT.txt "$pkgdir/usr/share/licenses/$pkgname"
}
